import { defHttp } from '@/utils/http/axios';
import { MenuListGetResultModel, MenuParams } from '@/api/system/model/menuModel';

const basePath = '/system/sysMenu/';
const buildUrl = (url: string) => basePath + url;
enum Api {
  GetMenuTree = 'menuTree',
  MenuAddOrUpdate = 'addOrUpdate',
}

export const getMenuList = (params?: MenuParams) =>
  defHttp.get<MenuListGetResultModel>({ url: buildUrl(Api.GetMenuTree), params });

export const menuAddOrUpdate = (params: any) =>
  defHttp.post({ url: buildUrl(Api.MenuAddOrUpdate), params });
